Import('RTT_ROOT')
Import('rtconfig')
from building import *

cwd = GetCurrentDir()
src	= []
for p in os.listdir(cwd) :
    if p.endswith(".c"):
        src += [p]
CPPPATH = [cwd,  cwd + "/../include", 
                 cwd + "/../packages/vsprintf", 
                 cwd + "/../packages/minmea", 
                 cwd + "/../packages/lua-cjson",
                 ]

# remove some packages

if not GetDepend(['RT_USING_PWM']):
    src.remove('luat_lib_pwm.c')
if not GetDepend(['RT_USING_I2C']):
    src.remove('luat_lib_i2c.c')
if not GetDepend(['RT_USING_SPI']):
    src.remove('luat_lib_spi.c')
if not GetDepend(['SAL_USING_POSIX']):
    src.remove('luat_lib_http.c')
    src.remove('luat_lib_socket.c')
if not GetDepend(['RT_USING_ADC']):
    src.remove('luat_lib_adc.c')
if not GetDepend(['PKG_USING_U8G2']):
    src.remove('luat_lib_disp.c')

src.remove('luat_shell.c')
src.remove('luat_lib_lpmem.c')
src.remove('luat_lib_pm.c')

src.remove('luat_lib_eink.c')
#src.remove('luat_lib_iconv.c')

group = DefineGroup('modules', src, depend = [''], CPPPATH = CPPPATH)

Return('group')
